package com.sc.nft.entity.vo.ecology;

import com.sc.nft.enums.EcologyExpendType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;

@Data
public class EcologyCastExpendVO {

    @ApiModelProperty(value = "消耗类型 ECOLOGY_POINTS:生态燃料 EQUITY_PROPS:权益道具")
    private EcologyExpendType expendType;

    @ApiModelProperty(value = "消耗名称")
    private String expendName;

    @ApiModelProperty(value = "消耗类型图片")
    private String expendImage;

    @ApiModelProperty(value = "消耗类型id")
    private String expendId;

    @ApiModelProperty(value = "消耗数量")
    private String expendCount;

    @ApiModelProperty(value = "消耗数量")
    private String holdCount;

    public void setExpendCount(BigDecimal expendCount) {
        if(expendType == EcologyExpendType.ECOLOGY_POINTS){
            this.expendCount = expendCount.setScale(2,BigDecimal.ROUND_DOWN).toPlainString();
        }else{
            this.expendCount = expendCount.stripTrailingZeros().toPlainString();
        }
    }

    public void setHoldCount(BigDecimal holdCount) {
        if(expendType == EcologyExpendType.ECOLOGY_POINTS){
            this.holdCount = holdCount.setScale(2,BigDecimal.ROUND_DOWN).toPlainString();
        }else{
            this.holdCount = holdCount.stripTrailingZeros().toPlainString();
        }
    }

}
